import wx
from socket import *
import threading


class Client(wx.Frame):
    def __init__(self):
        self.name = "percy"
        self.isConnected = False
        self.client_socket = None
        #         初始化父类
        wx.Frame.__init__(self, None, title=self.name + "聊天室", pos=(780, 250), size=(500, 650))
        self.pl = wx.Panel(self)
        self.conn_btn = wx.Button(self.pl, label="加入聊天室", pos=(10, 10), size=(200, 40))
        self.dis_btn = wx.Button(self.pl, label="离开聊天室", pos=(260, 10), size=(200, 40))
        self.clear_btn = wx.Button(self.pl, label="清空", pos=(10, 540), size=(200, 40))
        self.send_btn = wx.Button(self.pl, label="发送", pos=(260, 540), size=(200, 40))
        self.text = wx.TextCtrl(self.pl, size=(450, 320), pos=(10, 60), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.input_text = wx.TextCtrl(self.pl, size=(450, 120), pos=(10, 400), style=wx.TE_MULTILINE )

        self.Bind(wx.EVT_BUTTON, self.conn, self.conn_btn)
        self.Bind(wx.EVT_BUTTON, self.disconn, self.dis_btn)
        self.Bind(wx.EVT_BUTTON, self.clear, self.clear_btn)
        self.Bind(wx.EVT_BUTTON, self.send, self.send_btn)

    def conn(self, event):
        print("lianjie")
    def disconn(self, event):
        print("disconn")
    def clear(self, event):
        print("clear")
    def send(self, event):
        print("send")





if __name__ == "__main__":
    app = wx.App()
    client = Client()
    client.Show()
    app.MainLoop()
